<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateLogOperations   extends \App\Utils\CreateMigration
{
    function columns(Blueprint $table)
    {
        $table->unsignedBigInteger('user_id')->default(0)->comment('用户ID');
        $table->timestamp('time')->nullable()->comment('操作时间');
        $table->string('ip', 50)->default(0)->comment('IP地址');
        $table->string('server_addr', 50)->default(0)->comment('服务地址');
        $table->string('method', 10)->default(0)->comment('请求方式');
        $table->string('session_id', 100)->default('')->comment('sessionID');
        $table->string('url')->default('')->comment('请求地址');
        $table->string('route')->default('')->comment('route');
        $table->text('params')->nullable()->comment('请求参数');
        $table->index('session_id', 'index_session_id');
        $table->index('time', 'index_time');
    }

    function tableInfo()
    {
        return ['log__operations', '日志-后台操作日志'];
    }
}
